﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;

using JM.JCY.Proxy;
using JM.JCY.BusinessEntity;
using JM.JCY.Common;
using NCS.IConnect.ApplicationContexts;

namespace JM.JCY.SharePointComponent.PhotoAlbum.AlbumCategories
{
    public partial class AlbumCategoriesUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            HiddenFieldWebURL.Value = SPContext.Current.Web.ServerRelativeUrl;
            //if (!IsPostBack)
            //{
            //    if (Request.QueryString["ContextId"] != null)
            //    {
            //        this.hiddenContextId.Value = Request.QueryString["ContextId"].ToString();
            //    }
            //    string AlbumType = string.Empty;
            //    AlbumType = OCPConstant.AlbumType.FunWorkAlbum;
            //    int ContextId = Convert.ToInt32(ApplicationContext.Current.GetKeyValue("ContextId"));
            //    int StaffId = Convert.ToInt32(ApplicationContext.Current.GetKeyValue("StaffId"));
            //    string LoginAccount = ApplicationContext.Current.GetKeyValue("LoginAccount").ToString();
            //    string ContextType = new CommonFunctions().GetContextType();
            //    using (FunworkHeartworkProxy proxy = new FunworkHeartworkProxy())
            //    {
            //        AlbumDataSet.T_AlbumDataTable dtRecent = proxy.GetRecentlyUpdatedAlbums(AlbumType, ContextId, ContextType, StaffId, LoginAccount);
            //        dlRecentUpdate.DataSource = new CommonFunctions().GetDataByCount(dtRecent, 5);
            //        dlRecentUpdate.DataBind();

            //        AlbumDataSet.T_AlbumDataTable dtMostPopular = proxy.GetMostPopularAlbums(AlbumType, ContextId, ContextType, StaffId, LoginAccount);
            //        dlMostPopular.DataSource = new CommonFunctions().GetDataByCount(dtMostPopular, 5);
            //        dlMostPopular.DataBind();

            //        AlbumDataSet.T_AlbumDataTable dtMyContributions = proxy.GetMyContributionsAlbums(AlbumType, ContextId, ContextType, StaffId, LoginAccount);
            //        dlMyContributions.DataSource = new CommonFunctions().GetDataByCount(dtMyContributions, 5);
            //        dlMyContributions.DataBind();
            //    }
            //}
        }

        protected void DateList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            //Label lblContext = (Label)e.Item.FindControl("lblContext");
            //Image imgContext = (Image)e.Item.FindControl("imgContext");
            //new CommonFunctions().SetContextAndIcon(lblContext, imgContext, Convert.ToInt32(lblContext.Text.Trim()));
        }

        public string PartSubString(string fieldName, string fieldValue)
        {
            return "";// new CommonFunctions().PartSubString("AlbumCategories", fieldName, fieldValue);
        }
    }
}
